package foundation.rectangular_area_intersection;

import java.util.Scanner;

/**
 * 矩形面积交
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double[][] one = new double[2][2];
        double[][] two = new double[2][2];
        for (int i = 0; i < 2; i++) {
            for (int j = 0; j < 2; j++) {
                one[i][j] = sc.nextDouble();
            }
        }
        for (int i = 0; i < 2; i++) {
            for (int j = 0; j < 2; j++) {
                two[i][j] = sc.nextDouble();
            }
        }
        // 计算两确定重合矩形的对角线
        double m1 = Math.max(Math.min(one[0][0], one[1][0]), Math.min(two[0][0], two[1][0]));
        double n1 = Math.min(Math.max(one[0][1], one[1][1]), Math.max(two[0][1], two[1][1]));
        double m2 = Math.min(Math.max(one[0][0], one[1][0]), Math.max(two[0][0], two[1][0]));
        double n2 = Math.max(Math.min(one[0][1], one[1][1]), Math.min(two[0][1], two[1][1]));
        if (m1 < m2 && n1 > n2) {
            System.out.printf("%.2f", (m2 - m1) * (n1 - n2));
        } else {
            System.out.printf("%.2f", 0.0);
        }
    }
}
